﻿using System;
using Plugins;
using Utils;

namespace TimeBarPlugin
{
	[Serializable]
	internal class StrategyControlData : PropertyChangedNotifierCopyable<StrategyControlData>, ICloneable<StrategyControlData>
	{
		#region Attributes

		private ExecutionDirection _executionDirection;
		private decimal _resetThreshold;
		private decimal _stopLoss;
		private int _volumeIncrement;
		private VolumeMode _volumeMode;
		private bool _invertLogic;
		private bool _stopLossAt0;
		private int _quantityToBuy;
		private bool _dynamicStop;
		private int _maxVolume;
		private decimal _maxInverseValue;
		private decimal _maxProfit;
		private int _blockTime;

		#endregion

		#region  Properties

		public ExecutionDirection ExecutionDirection
		{
			get
			{
				return _executionDirection;
			}
			set
			{
				if (_executionDirection != value)
				{
					_executionDirection = value;
					base.OnPropertyChanged("ExecutionDirection");
				}
			}
		}

		public decimal ResetThreshold
		{
			get
			{
				return _resetThreshold;
			}
			set
			{
				if (_resetThreshold != value)
				{
					_resetThreshold = value;
					base.OnPropertyChanged("ResetThreshold");
				}
			}
		}

		public decimal StopLoss
		{
			get
			{
				return _stopLoss;
			}
			set
			{
				if (_stopLoss != value)
				{
					_stopLoss = value;
					base.OnPropertyChanged("StopLoss");
				}
			}
		}

		public int VolumeIncrement
		{
			get
			{
				return _volumeIncrement;
			}
			set
			{
				if (_volumeIncrement != value)
				{
					_volumeIncrement = value;
					base.OnPropertyChanged("VolumeIncrement");
				}
			}
		}

		public VolumeMode VolumeMode
		{
			get
			{
				return _volumeMode;
			}
			set
			{
				if (_volumeMode != value)
				{
					_volumeMode = value;
					base.OnPropertyChanged("VolumeMode");
				}
			}
		}

		public bool InvertLogic
		{
			get
			{
				return _invertLogic;
			}
			set
			{
				if (_invertLogic != value)
				{
					_invertLogic = value;
					base.OnPropertyChanged("InvertLogic");
				}
			}
		}

		public bool StopLossAt0
		{
			get
			{
				return _stopLossAt0;
			}
			set
			{
				if (_stopLossAt0 != value)
				{
					_stopLossAt0 = value;
					base.OnPropertyChanged("StopLossAt0");
				}
			}
		}
		
		public bool DynamicStop
		{
			get
			{
				return _dynamicStop;
			}
			set
			{
				if (_dynamicStop != value)
				{
					_dynamicStop = value;
					base.OnPropertyChanged("DynamicStop");
				}
			}
		}

		public int QuantityToBuy
		{
			get
			{
				return _quantityToBuy;
			}
			set
			{
				if (_quantityToBuy != value)
				{
					_quantityToBuy = value;
					base.OnPropertyChanged("QuantityToBuy");
				}
			}
		}

		public int MaxVolume
		{
			get
			{
				return _maxVolume;
			}
			set
			{
				if (_maxVolume != value)
				{
					_maxVolume = value;
					base.OnPropertyChanged("MaxVolume");
				}
			}
		}

		public decimal MaxInverseValue
		{
			get
			{
				return _maxInverseValue;
			}
			set
			{
				if (_maxInverseValue != value)
				{
					_maxInverseValue = value;
					base.OnPropertyChanged("MaxInverseValue");
				}
			}
		}

		public decimal MaxProfit
		{
			get
			{
				return _maxProfit;
			}
			set
			{
				if (_maxProfit != value)
				{
					_maxProfit = value;
					base.OnPropertyChanged("MaxProfit");
				}
			}
		}

		public int BlockTime
		{
			get
			{
				return _blockTime;
			}
			set
			{
				if (_blockTime != value)
				{
					_blockTime = value;
					base.OnPropertyChanged("BlockTime");
				}
			}
		}

		#endregion

		#region ICloneable

		public StrategyControlData Clone()
		{
			return (StrategyControlData)this.MemberwiseClone();
		}

		#endregion
	}
}
